The present invention relates to a system of program objects and program components and communication between program objects and program components, and to an apparatus using this system.
Recently a new software technique has been developed, the so-called object oriented technique. The term object oriented means that software is organized as a set of discrete modules or program objects, that comprise both a data structure and behavior (operations), i.e. series of actions. This is contrary to the conventional programming technique, in which data structure and behavior are only loosely connected.
A program object is a run-time entity with his own thread of threads of execution with his own system resources. Program objects with the same data structure and behaviour (operations) are grouped into a class. Each object is an instance of a certain class. The operations determine the messages to which the object can respond, while the state is hidden from the outside like for example other objects. Variables that represent the internal state of an object are called instance variables and the operations thereof are called methods.
Each program object has an execution space that describes the properties of the object like which memory areas the object can access, which threads the object code execute and which is the run-time environment of the object. Communication between program objects occurs by message passing. In the non pre-published Japanese application No. 09-092446 of applicant a form of message passing is described. To execute message passing each object has an external interface, also called send interface, which arranges the receiving of the messages and with which the different methods of the corresponding program object are operable.
In the execution space of a program object a shared library in the form of one or more program components can be loaded. The program component is in this respect the shared library implementation for an object. A program component is loaded in an object if the program component is situated in the execution space of this object. A program component may provide an internal interface which is an ordered list of functions or methods that are implemented by the program component and that can be called by any function or method of the object.
In the Article by Erickson C. et al: xe2x80x9cSOMOBJECTS DEVELOPER TOOLKIT: SHARING SOM OBJECTS WITH DSOMxe2x80x9d OS/2 DEVELOPER, Vol. 6, No. 1, January 1994, it is disclosed to load a Dynamic Link Library (DLL) dynamically which is a standard implementation of a shared library. The DLL is provided with an external or send interface which enables message passing communication between the DLL and different program objects.
The DLL is however merely used to implement a given and fixed external interface, i.e. the external interface of the program object remains unchanged by loading the DLL.
According to an aspect of the present invention a system is provided, which comprises:
a program object with one or more functions;
an external interface with a description of the functions for communication with other program objects;
wherein upon loading of a program component a description of one or more functions of the program component is exported to the external interface of the program object. When a program component is loaded, the send interface of the program component is automatically exported to the send interface of the host object. This means that the send interface of the object is modified to contain the send interface of the program component. Therefore it is possible to communicate by message passing between program components of a program object and other program objects. There is no relationship between the content of the send interface and the content of the internal interface of an program component. A method of program component may appear in either, in both or in none.
According to a preferred embodiment a system is provided, wherein upon loading of an additional program component the description of one or more functions thereof is added to the external interface of the program object for communication with other program objects.
According to a preferred embodiment a system is provided, wherein upon removing a program component the description thereof in the external interface of the program object is removed from the external interface.
According to a further preferred embodiment of the present invention a system is provided, wherein upon replacing a first program component by a second program component, the description in the external interface of one or more functions of the first program component is replaced by a description of one or more functions of the second program component.
According to a further preferred embodiment a system is provided, wherein program components are loaded dynamically at run time.
The present invention provides for dynamic loading of program components with an external interface. Because loading a program component with a send interface will add this interface to the host object, and because program components can be dynamically added or replaced program components, the interface of the host objects can evolve over time. The interface of an object can shrink, such as when one program component is removed, or it can grow, as when a new program component is linked with (or an old program component is replaced by) an extended interface.
When a new implementation is required to for example implement a bug fix, implementation evolution can be utilised. This is administered by simply removing a dynamic linked program component and replacing it with a different program component that implements the same functionality in a different way.
A program component may or may not provide an internal or send interface. If it does not provide a send interface, it can only be invoked through a function call. In this case, it can also only be called from within the same execution space. Similarly, if a program component provides only a send interface, it is only accessible by other objects through message passing mechanisms.
Prior art high-level programs usually are translated into binary executable code by a compiler. In the last stage of compilation, a link editor links all the object executable files together with the start-up codes and library functions which are referenced in the program. In static linking, the link editor will incorporate a copy of the object files into the executable at link time. A static library is a collection of object files which contain library routines and data. In dynamic linking, the shared libraries are mapped at run time. The link editor will only store in the executable the name of the shared library and some additional information about the symbols referenced by the executable. With dynamic loading a routine is loaded only when it is called, thereby saving memory by not loading routines that are unused or rarely used. More specifically, dynamic loading can attach a shared library to the address space of the process during execution, look up the address of a function in the library, activate that function and then detach the shared library, e.g. remove it from memory, when it is no longer needed.
According to another aspect of the invention an apparatus is provided, comprising:
memory means for temporarily storing data;
processing means for processing data; and
connecting means for connection between the memory means and processing means, wherein the above mentioned system is used.
According to another aspect of the invention a method is provided, comprising:
providing a program object with an external interface, that contains a description of one or more functions of the program object, for communication with other program objects;
loading a program component with one or more functions;
exporting a description of one or more functions of the loaded program component to the external interface of the program object.